home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Best of MacTutor - S…e Code for Volumes 1 to 5
/
The Best of MacTutor - Source Code for Volume 1-5 (Wayzata Technology)(6031)(1990).bin
/
Source Code
/
#39 (Dec 88)
/
KeyEdDemo
/
KeyEdDemo.asm
< prev
next >
Wrap
Assembly Source File
|
1988-06-24
|
1KB
|
74 lines
;MDS source code for KeyEDDemo External procedures
;copyright F.Samuel and Mac Tutor 1988
; After compiling , turn the .rel file into a LSP
; library using rel.Converter , then include the lib
; into your LSP project
;MDS Glues for Pascal Peek and Poke
;procedure poke(address:ptr;value:byte)
;function peek(address:ptr): byte;
XDEF peek
XDEF poke
value EQU 8
addr1 EQU 10
poke
LINK A6,#0
MOVEA.L addr1(A6),A0
MOVE value(A6),D0
MOVE.B D0,(A0)
UNLK A6
MOVEA.L (SP)+,A0
ADDQ.L #6,SP
JMP (A0)
addr2 EQU 8
result EQU 12
peek
LINK A6,#0
MOVEA.L addr2(A6),A0
MOVEQ #0,D0
MOVE.B (A0),D0
MOVE D0,result(A6)
UNLK A6
MOVEA.L (SP)+,A0
ADDQ.L #4,SP
JMP (A0)
; Function Key12Trans(KeyCode,KeyModifs:Integer) : Integer;
; KeyModifs are as they appear in the third word of KeyMap
; Function returns AsciiCode
XDEF Key12Trans
Key1Trans EQU $29E
Key2Trans EQU $2A2
KeyModifs EQU 8
KeyCode EQU 10
FunRslt EQU 12
Key12Trans
LINK A6,#0
MOVEM.L A0/D0-D3,-(SP)
MOVE KeyCode(A6),D2
MOVE KeyModifs(A6),D1
MOVEQ #0,D3
CMPI #64,D2
BHS.S @1
MOVEA.L Key1Trans,A0
BRA.S @2
@1 MOVEA.L Key2Trans,A0
@2 JSR (A0)
MOVE D0,FunRslt(A6)
MOVEM.L (SP)+,A0/D0-D3
UNLK A6
MOVEA.L (SP)+,A0
ADDQ.L #4,SP
JMP (A0)